package cn.fudong.bos.action.take_delivery;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import cn.fudong.bos.action.commom.BaseAction;
import cn.fudong.bos.domain.take_delivery.Order;
import cn.fudong.bos.service.take_delivery.OrderService;

/**
 * 
 * @description: 后台bos_management 的订单管理
 * @author ：d_fu
 * @date 创建时间：2018年3月27日 下午10:04:10
 *
 */
@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class OrderAction extends BaseAction<Order> {
	
	
	
	@Autowired
	private OrderService orderservice;
	
	
	
	// order_findByOrderNum
	@Action(value = "order_findByOrderNum", results = { @Result(name = "success", type = "json") })
	public String findByOrderNum() {
		
		//调业务层方法查询
		Order order =orderservice.findByOrderNum(model.getOrderNum());
		//创建Map集合
		Map<String,Object> result =new HashMap<String,Object>();
		//判断是否有值
		if(order==null){
			//如果为空
			result.put("success", false);
		}else{
			//如果不为空
			result.put("success", true);
			result.put("orderData", order);
		}
		
		pushDataToValueStack(result);
		return SUCCESS;
		
	}

}
